package cn.hchaojie.camp.day04;

import org.junit.Test;

public class TestStudent {
	/**
	 * 测试构造器
	 */
	@Test
	public void testConstructor() {
		Student s = new Student();
		s.speak("我是大神！");
		
		System.out.println(s);
		change(s);
		System.out.println(s);
		
		s = new Student("提莫");		// 引用指向另外一个对象
		s.speak("我是提莫！");
	}
	
	public void change(Student s) {
		s = new Student("提莫");
	}
	
	@Test
	public void testStaticField() {
		Student.id = 2;
		System.out.println(Student.id);
		
		test();
	}
	
	public void test() {
		System.out.println(Student.id);
	}
	
	@Test
	public void testStaticField2() {
		System.out.println(Student.id);
	}
	
	@Test
	public void testObjectComposite() {
		Employee e = new Employee();
		e.setName("部门经理");

		Department d = new Department();
		d.setName("研发部");
		d.setNo(1);
		d.setManager(e);		// 对象组合
	}
}
